package com.filldream.fastboot.core.job.task;

import com.filldream.fastboot.common.constant.FinalStr;
import com.filldream.fastboot.common.okutil.RobotUtil;
import com.filldream.fastboot.common.okutil.cls.dto.ClsNewsSimpleItem;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import java.util.*;

@Slf4j
@Service
@Component("GoodNightTask")
@RequiredArgsConstructor
public class GoodNightTask {

    /**
     * 发送晚安消息
     */
    public static void sayGoodNight() {
        //晚安语
        ClsNewsSimpleItem goodNightItem = new ClsNewsSimpleItem();
        goodNightItem.setLinkUrl("");
        goodNightItem.setTitle("晚安，化债人！消息明日再推送，如有需求请点击下方按钮哦~");
        goodNightItem.setIsTop(true);
        //点击按钮
        Map<String, String> btnMap = new HashMap<>();
        String baseUrl = !FinalStr.getActive().equals("dev") ? "http://118.195.133.175:8110" : "http://localhost:8110";
        btnMap.put("获取财联社新闻", baseUrl + "/common/cls/cls/autoSendOwner");
        btnMap.put("获取东财新闻", baseUrl + "/common/eastCf/news/autoSendOwner");
        btnMap.put("获取个股公告", baseUrl + "/common/eastCf/ann/autoSendOwner");
        btnMap.put("获取个股资讯", baseUrl + "/common/eastCf/article/autoSendOwner");
        btnMap.put("刷新股市指数", baseUrl + "/common/stock/refreshStockIndex");
        RobotUtil.autoDD(Arrays.asList( goodNightItem ) ,btnMap);
    }

}